package com.example.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.example.studyapplication.R;
/**
 * @author haojie.gec
 */
public class TouchEventActivity extends Activity {

    private final static String TAG = "touch:Activity";

    public static void startActivity(Context mContext){
        mContext.startActivity(new Intent(mContext, TouchEventActivity.class));
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        setContentView(R.layout.activity_touch_event);
        super.onCreate(savedInstanceState);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.d(TAG, "dispatchTouchEvent：ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d(TAG, "dispatchTouchEvent：ACTION_MOVE");
                break;
            case MotionEvent.ACTION_UP:
                Log.d(TAG, "dispatchTouchEvent：ACTION_UP");
                break;
            default:
                break;
        }
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.d(TAG, "onTouchEvent：ACTION_DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d(TAG, "onTouchEvent：ACTION_MOVE");
                break;
            case MotionEvent.ACTION_UP:
                Log.d(TAG, "onTouchEvent：ACTION_UP");
                break;
            default:
                break;
        }
        return super.onTouchEvent(event);
    }

    public void CustomConstrainLayout(View view){
        Log.d(TAG, "1111111111CustomConstrainLayout");
    }

    public void CustomRelativeLayout(View view){
        Log.d(TAG, "11111111111CustomRelativeLayout");
    }

    public void CustomLinearLayout(View view){
        Log.d(TAG, "11111111111CustomLinearLayout");
    }

    public void CustomButton(View view){
        Log.d(TAG, "11111111111CustomButton");
    }

}
